<!-- 
All rights Reserved, Designed By www.youyacao.com 
@Description:注册页
@author:成都市一颗优雅草科技有限公司     
@version V3.0
@松鼠聚合直播系统
注意：本前端源码遵循 蜻蜓优雅草产品开源授权协议，本内容仅限于个人参考，禁止用于其他的商业用途
需要商业用途或者定制开发等可访问songshu.youyacao.com   联系QQ:422108995 23625059584

 -->













<template>
	<view class="regster-page">
		<view class="regster-box">
			<view class="regster-row">
				<uni-icons type="person" class="tubiao" size="30" />
				<input class="input" type="number" placeholder="请输入手机号" v-model="username" />
			</view>
			<view class="regster-row">
				<uni-icons type="locked" class="tubiao" size="30" />
				<input class="input" :password="true"  placeholder="输入密码" v-model="password" />
			</view>
			<view class="regster-row">
				<uni-icons type="locked" class="tubiao" size="30" />
				<input class="input" :password="true" placeholder="再输一次密码" v-model="repassword" />
			</view>
			<view class="regster-row">
				<uni-icons type="personadd" class="tubiao" size="30" />
				<input class="input" type="text" placeholder="输入邀请码" v-model="tuijianma" />
			</view>
			<view style="height: 80rpx;"></view>
			<view class="button-box">
				<button type="primary" @click="doRegister()" :disabled ="isSubmit">确认注册</button>
			</view>
			<view class="button-box">
			  <button type="default" @click="goLogin()">返回登陆</button>
			</view>
		</view>
	</view>
</template>

<script>
	import uniIcons from "../../components/yangxiaochuang-icons/yangxiaochuang-icons.vue";
	export default {
		components: {uniIcons},
		data() {
			return {
				username:'',
			    password:'',
			    repassword:'',
			    tuijianma:'',
				isSubmit:false
			}
		},
		methods: {
			doRegister:function () {
			  var that = this;
			  this.isSubmit = true;
			  uni.showLoading({
			  	title:"登陆中..."
			  });
			  this.request.post({
				  url:"index.php/index/index/register",
				  data:{
					username:this.username,
					password:this.password,
					repassword:this.repassword,
					tuijianma:this.tuijianma
				  },
				  success:(res)=>{
					uni.hideLoading();
					this.isSubmit = false;
					if(res.data.code != 1){
					  this.password = '';
					  uni.showToast({
					  	icon:"none",
						title:res.data.msg
					  });
					}else{
					  uni.showModal({
					  	showCancel:false,
						title:"提示",
						content:"恭喜您，注册成功！"
					  })
					}
				  },
				  fail:()=>{
					this.isSubmit = false;
					uni.hideLoading();
				  }
			  });
			},
			goLogin:function () {
			  uni.navigateBack({
			  	delta:1
			  })
			}
		}
	}
</script>

<style scoped>
.regster-page{
  background: #f5f5f5;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.regster-box{
	display: flex;
	flex-direction: column;
	padding:50rpx 20rpx;
	background: white;
	width: 600rpx;
	margin-top: 100rpx;
	border: lightgrey 1rpx solid;
	border-radius: 10rpx;

}
.regster-row{
	display: flex;
	flex-direction: row;
  font-size: 48rpx;
  border-bottom: lightgrey 1rpx solid;
  padding: 20rpx 0rpx;
}
.regster-row .input{
  outline: none;
  border: none;
  font-size: 36rpx;
}
.regster-row .tubiao{
	width: 80rpx;
}
.button-box{
  padding: 20rpx 0px;
  text-align: center;
  font-size: 30rpx;
}
</style>
